﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Collections.Specialized;

namespace GPTASUI
{
    public partial class NewAllocation : Form
    {
        public NewAllocation()
        {
            InitializeComponent();
        }

        public static int noofgroups = 0;

        private void NewAllocation_Load(object sender, EventArgs e)
        {
            DisplayAllocationSettings();
        }

        public void DisplayAllocationSettings()
        {
            foreach (String s in ConfigurationManager.AppSettings.AllKeys)
            {
                flpAppSettings.FlowDirection = FlowDirection.TopDown;
                AppSetting a = new AppSetting();
                a.lblSetting.Text = s;
                a.txtValue.Text = ConfigurationManager.AppSettings[s];
                flpAppSettings.Controls.Add(a);
            }
        }

        private void btnSavenewAllocationSetting_Click(object sender, EventArgs e)
        {
            foreach (Control c in flpAppSettings.Controls)
            {
                if (c is AppSetting)
                {
                    AppSetting a = c as AppSetting;
                    if (a.lblSetting.Text == "NumberofGroups")
                    {
                        noofgroups = Convert.ToInt32(a.txtValue.Text);
                    }
                }
            }
            NewGroupNames n = new NewGroupNames();
            n.Show();
        }
    }
}
